(global.webpackJsonp = global.webpackJsonp || []).push([ [ "annex/order/putOrder" ], {
    "5a55": function(e, n, o) {
        var r = o("6577");
        o.n(r).a;
    },
    6577: function(e, n, o) {},
    9984: function(e, n, o) {
        o.d(n, "b", function() {
            return r;
        }), o.d(n, "c", function() {
            return i;
        }), o.d(n, "a", function() {});
        var r = function() {
            this.$createElement;
            this._self._c;
        }, i = [];
    },
    c6b9: function(e, n, o) {
        o.r(n);
        var r = o("dc59"), i = o.n(r);
        for (var t in r) "default" !== t && function(e) {
            o.d(n, e, function() {
                return r[e];
            });
        }(t);
        n.default = i.a;
    },
    d37f: function(e, n, o) {
        (function(e) {
            o("1067"), r(o("66fd"));
            var n = r(o("e050"));
            function r(e) {
                return e && e.__esModule ? e : {
                    default: e
                };
            }
            wx.__webpack_require_UNI_MP_PLUGIN__ = o, e(n.default);
        }).call(this, o("543d").createPage);
    },
    dc59: function(e, n, o) {
        (function(e) {
            Object.defineProperty(n, "__esModule", {
                value: !0
            }), n.default = void 0;
            var r, i = o("26cb"), t = (function(e) {
                e && e.__esModule;
            }(o("03b8")), o("7a6d"), o("db8f")), c = o("9b04"), a = o("7960"), s = o("c2bf"), u = o("871c"), f = o("a71e"), d = o("0cc1"), p = o("8434"), _ = o("4771");
            function h(e, n) {
                var o = Object.keys(e);
                if (Object.getOwnPropertySymbols) {
                    var r = Object.getOwnPropertySymbols(e);
                    n && (r = r.filter(function(n) {
                        return Object.getOwnPropertyDescriptor(e, n).enumerable;
                    })), o.push.apply(o, r);
                }
                return o;
            }
            function l(e) {
                for (var n = 1; n < arguments.length; n++) {
                    var o = null != arguments[n] ? arguments[n] : {};
                    n % 2 ? h(Object(o), !0).forEach(function(n) {
                        m(e, n, o[n]);
                    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(o)) : h(Object(o)).forEach(function(n) {
                        Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(o, n));
                    });
                }
                return e;
            }
            function m(e, n, o) {
                return n in e ? Object.defineProperty(e, n, {
                    value: o,
                    enumerable: !0,
                    configurable: !0,
                    writable: !0
                }) : e[n] = o, e;
            }
            var y = "", b = (r = {
                components: {
                    kpForm: function() {
                        Promise.all([ o.e("common/vendor"), o.e("components/kp-form/kp-form") ]).then(function() {
                            return resolve(o("b1b0"));
                        }.bind(null, o)).catch(o.oe);
                    }
                },
                data: function() {
                    var e;
                    return {
                        annex: (e = {
                            title: "",
                            price: "",
                            term_type: ""
                        }, m(e, "price", ""), m(e, "id", ""), m(e, "is_form", 0), m(e, "form_id", ""), m(e, "img", ""), 
                        m(e, "price_type", ""), e),
                        user_id: "",
                        isChooseImg: !1,
                        form: [],
                        payData: {},
                        isPay: -1,
                        formShow: !1,
                        isShow: !1,
                        show: !1,
                        time_limit: "",
                        froms: "",
                        coupon: "请选择优惠券",
                        choiceCouponId: "",
                        isShowCoupon: !1,
                        total_price: "",
                        isVip: ""
                    };
                },
                computed: l({}, (0, i.mapGetters)([ "configs", "user", "mainColor", "iphoneXStyle", "isIphone", "priceColor" ])),
                created: function() {},
                onShow: function() {
                    var n = this;
                    e.getStorage({
                        key: "couponUrl",
                        success: function(e) {
                            (0, f.isEmpty)(e.data) || (n.choiceCouponId = JSON.parse(e.data).id, n.totalPrice());
                        }
                    });
                },
                onUnload: function() {
                    e.removeStorage({
                        key: "couponUrl",
                        success: function(e) {}
                    });
                },
                onHide: function() {
                    e.removeStorage({
                        key: "couponUrl",
                        success: function(e) {}
                    });
                },
                mounted: function() {
                    var e = this;
                    y = this, (0, _.getStorageSync)("userInfo").then(function(n) {
                        var o = JSON.parse(n.data);
                        (0, f.isEmpty)(o.id) || (e.user_id = o.id), e.getDetail();
                    }, function(n) {
                        e.getDetail();
                    });
                },
                onLoad: function(e) {
                    var n = this;
                    this.annex.id = e.id, n.froms = e.froms || "", n.isVip = "true" == e.isVip, n.course_id = e.course_id || "", 
                    1 != e.price_type && n.isPayType();
                }
            }, m(r, "computed", l({}, (0, i.mapGetters)([ "configs", "user", "mainColor", "iphoneXStyle", "isIphone" ]))), 
            m(r, "methods", {
                totalPrice: function() {
                    var e = this, n = {
                        type: 3,
                        product_id: this.annex.id,
                        user_coupon_id: this.choiceCouponId
                    };
                    (0, u.afterCoupon)(n).then(function(n) {
                        e.annex.price = parseFloat(n.price) < 0 ? 0 : n.price, e.coupon = "减" + n.coupon_price + "元";
                    });
                },
                chooseCoupon: function() {
                    var e = this;
                    (0, a.h5JudgeLogin)(2).then(function(n) {
                        n || (0, p.route)({
                            url: "/coupon/list",
                            type: 1,
                            data: {
                                useType: 2,
                                product_id: e.annex.id,
                                type: 3
                            }
                        });
                    });
                },
                isPayType: function() {
                    var e = this;
                    (0, c.payMethod)().then(function(n) {
                        -1 == n.indexOf("wxpay") && (e.isPay = 0);
                    });
                },
                getDetail: function() {
                    var e = this, n = {
                        id: this.annex.id,
                        user_id: e.user_id,
                        isLoading: !0
                    };
                    (0, s.annexInfo)(n).then(function(n) {
                        e.annex = n, e.total_price = n.price, 1 == n.is_form ? e.formShow = !0 : e.formShow = !1, 
                        n.is_form && e.$nextTick(function() {
                            e.$refs.formOrder.getForm(e.annex.form_id, 5);
                        }), e.isShow = !0, 1 == e.annex.is_alone_sale && 1 == e.annex.price_type && !e.annex.is_buy || 1 == e.froms && !e.annex.is_buy || e.isVip && 1 == e.annex.vip_free_see && !e.annex.is_buy || -1 == e.configs.coupon_set.indexOf("annex") ? e.isShowCoupon = !1 : e.isShowCoupon = !0;
                    });
                },
                checks: function() {
                    this.$refs.formOrder.Order();
                },
                chooseImgs: function(e) {
                    this.isChooseImg = e;
                },
                choosePay: function(e) {
                    this.isPay = 1 == e.typeId ? 3 : 2, this.Order();
                },
                Orders: function(e) {
                    var n = this;
                    n.form = e, 1 == n.annex.price_type && !n.annex.is_buy || 1 == n.froms || n.isVip && 1 == n.annex.vip_free_see && !n.annex.is_buy ? n.freeOrder() : n.Order();
                },
                freeOrder: function() {
                    var e, n = this;
                    e = 1 == n.froms ? 9 : n.isVip && 1 == n.annex.vip_free_see ? 5 : 4;
                    var o = {
                        annex_id: this.annex.id,
                        course_id: this.course_id,
                        is_form: this.annex.is_form,
                        form_data: this.form,
                        form_id: this.annex.form_id,
                        payType: e,
                        order_id: ""
                    };
                    (0, s.subAnnexOrder)(o).then(function(e) {
                        (0, p.route)({
                            url: "/annex/detail",
                            type: 3,
                            data: {
                                id: n.annex.id
                            }
                        });
                    });
                },
                Order: function() {
                    var e = this;
                    if (0 == e.isPay) return e.$toast("未设置支付方式", "none"), !1;
                    var n = {
                        annex_id: this.annex.id,
                        course_id: this.course_id,
                        is_form: this.annex.is_form,
                        form_data: this.form,
                        form_id: this.annex.form_id,
                        payType: 1,
                        use_user_coupon_id: e.choiceCouponId
                    };
                    e.show = !0, (0, s.subAnnexOrder)(n).then(function(n) {
                        e.show = !1, (0, d.pay)(n, e.orderSuccess, e.orderFail, "");
                    });
                },
                orderSuccess: function(e) {
                    (0, p.route)({
                        url: "/annex/detail",
                        type: 3,
                        data: {
                            id: this.annex.id
                        }
                    });
                },
                orderFail: function(e) {
                    console.log("失败啦!");
                },
                putOrder: (0, t.throttle)(function() {
                    1 == y.annex.is_form ? y.$refs.formOrder.check() : 1 == y.annex.price_type && !y.annex.is_buy || 1 == y.froms || y.isVip && 1 == y.annex.vip_free_see && !y.annex.is_buy ? y.freeOrder() : y.Order();
                }, 1500)
            }), r);
            n.default = b;
        }).call(this, o("543d").default);
    },
    e050: function(e, n, o) {
        o.r(n);
        var r = o("9984"), i = o("c6b9");
        for (var t in i) "default" !== t && function(e) {
            o.d(n, e, function() {
                return i[e];
            });
        }(t);
        o("5a55");
        var c = o("f0c5"), a = Object(c.a)(i.default, r.b, r.c, !1, null, "28b72b38", null, !1, r.a, void 0);
        n.default = a.exports;
    }
}, [ [ "d37f", "common/runtime", "common/vendor" ] ] ]);